from flask import Flask,request
from gevent import pywsgi
app = Flask(__name__)

@app.route('/')
def hello_world():
    question = request.args.get("question")
    from langchain_community.llms import Tongyi
    import os
    os.environ["DASHSCOPE_API_KEY"] = "sk-10920ad0a9d542af96353edd7ab3e613"
    llm = Tongyi()
    answer = llm.invoke(question)
    return f'我的问题是:{question}\n我的答案:{answer}'

if __name__ == '__main__':
    #server = pywsgi.WSGIServer(('0.0.0.0',5000),app)
    #server.serve_forever()
    app.run('0.0.0.0',80)